﻿/*---------------------------------------------------------------------------------
-----------------***DaLianQianYi***-----------------------
-----------------作者：大连仟亿科技------------------------------------------------------
-----------------联系作者：www.qianyikeji.com----------------------------------
-----------------时间：2018/5/5 18:07:44------------------------------------------
----------------------------------------------------------------------------------*/

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

namespace Donal.Xms.BLL
{
    /// <summary>
    ///数据业务层
    /// </summary>
    public partial class spec_action
    {
        private readonly Model.sysconfig sysConfig;//获得系统配置信息
        private readonly DAL.spec_action dal;

        public spec_action(bool isRuntime = false)
        {
            sysConfig = new BLL.sysconfig().loadConfig();//获得系统配置信息
            dal = new DAL.spec_action(sysConfig.sysdatabaseprefix);
        }

        public spec_action(Model.sysconfig _sysConfig)
        {
            sysConfig = _sysConfig;
            dal = new DAL.spec_action(sysConfig.sysdatabaseprefix);
        }

        #region 基本方法================================
        /// <summary>
        /// 是否存在该记录
        /// </summary>
        public bool Exists(int id)
        {
            return dal.Exists(id);
        }

        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(Model.spec_action model)
        {
            return dal.Add(model);
        }

        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Model.spec_action model)
        {
            return dal.Update(model);
        }

        /// <summary>
        /// 删除一条数据
        /// </summary>
        public bool Delete(int id)
        {
            return dal.Delete(id);
        }

        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Model.spec_action GetModel(int id)
        {
            return dal.GetModel(id);
        }

        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Model.spec_action GetModel(int spec_id, int action_id, int action_type)
        {
            return dal.GetModel(spec_id, action_id, action_type);
        }



        /// <summary>
        /// 获得前几行数据
        /// </summary>
        public DataSet GetList(int Top, string strWhere, string filedOrder)
        {
            return dal.GetList(Top, strWhere, filedOrder);
        }

        /// <summary>
        /// 获得前几行属性值ID数据
        /// </summary>
        /// <param name="action_type">action_type=1款式 0商品</param>
        /// <param name="call_index">调用别名</param>
        /// <param name="action_id">款ID 或 商品ID</param>
        public string GetSpecItemsIdList(int action_type, string call_index, int action_id)
        {
            return dal.GetSpecItemsIdList(action_type, call_index, action_id);
        }

        /// <summary>
        /// 获得前几行数据
        /// </summary>
        public DataSet GetListView(int Top, string strWhere, string filedOrder)
        {
            return dal.GetListView(Top, strWhere, filedOrder);
        }

        /// <summary>
        /// 获得查询分页数据
        /// </summary>
        public DataSet GetList(int pageSize, int pageIndex, string strWhere, string filedOrder, out int recordCount)
        {
            return dal.GetList(pageSize, pageIndex, strWhere, filedOrder, out recordCount);
        }
        #endregion

        #region 扩展方法================================
        /// <summary>
        /// 返回指定列
        /// </summary>
        public string GetValue(int id, string fileName)
        {
            return dal.GetValue(id, fileName);
        }

        /// <summary>
        /// 修改一列数据
        /// </summary>
        public bool UpdateField(int id, string strValue)
        {
            return dal.UpdateField(id, strValue);
        }

        /// <summary>
        /// 执行
        /// </summary>
        public bool ExecuteSql(string strValue)
        {
            return dal.ExecuteSql(strValue);
        }

        /// <summary>
        /// 获得数据
        /// </summary>
        public DataSet GetList(string strSql)
        {
            return dal.GetList(strSql);
        }
        #endregion
    }
}


